﻿#ifndef UCOMMONBUTTON_H
#define UCOMMONBUTTON_H

#include "utkwidget_export.h"
#include "style/ustyleoption.h"

#include <QPushButton>
#include <QEvent>

class UCommonButtonPrivate;
class UTKWIDGET_EXPORT UCommonButton : public QPushButton
{
    Q_OBJECT
public:
    explicit UCommonButton(const QString text, QWidget* parent = nullptr);
    explicit UCommonButton(QWidget* parent = nullptr);
    ~UCommonButton();

    Qt::Alignment alignment() const;

    void setAlignment(Qt::Alignment alignment);

    void setButtonFeature(UCommonButtonOption::ButtonFeature feature);

    void setRadius(int radius);

    void setBackgroundRole(int role);

    void setForegroundRole(int role);

    void setRadiuPosition(RadiuPosition position);

protected:
    void paintEvent(QPaintEvent* event) override;

    virtual void initStyleOption(UCommonButtonOption* option) const;

private:
    QScopedPointer<UCommonButtonPrivate> d_ptr;
    Q_DISABLE_COPY(UCommonButton)
    Q_DECLARE_PRIVATE_D(d_ptr, UCommonButton)
};

#endif // UCOMMONBUTTON_H
